package org.xiaoyu.feign.core.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.xiaoyu.feign.core.FeignOkHttp3Client;

import feign.Client;
import feign.Contract;
import feign.Logger;
import feign.QueryMapEncoder;
import feign.Request;
import feign.Request.Options;
import feign.Retryer;
import feign.codec.Decoder;
import feign.codec.Encoder;
import feign.codec.ErrorDecoder;

/**
 * feign自定义配置
 * @author zhangsaizz
 *
 */
@Target({ ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Config {

	/**
	 * 解码
	 * @return
	 */
	Class<? extends Decoder> decoder() default Decoder.Default.class;

	/**
	 * 编码
	 * @return
	 */
	Class<? extends Encoder> encoder() default Encoder.Default.class;

	/**
	 * 错误编码
	 * @return
	 */
	Class<? extends ErrorDecoder> errorDecoder() default ErrorDecoder.Default.class;

	/**
	 * 指定http客户端
	 * @return
	 */
	Class<? extends Client> client() default FeignOkHttp3Client.class;

	/**
	 * 注解的实现
	 * @return
	 */
	Class<? extends Contract> contract() default Contract.Default.class;

	/**
	 * 将对象编码为查询参数名称到值的映射。
	 * @return
	 */
	Class<? extends QueryMapEncoder> queryMapEncoder() default QueryMapEncoder.Default.class;

	/**
	 * 重试方式
	 * @return
	 */
	Class<? extends Retryer> retryer() default Retryer.Default.class;

	/**
	 * 日志处理
	 * @return
	 */
	Class<? extends Logger> logger() default Logger.NoOpLogger.class;
	
	/**
	 * 是否解码404
	 * @return
	 */
	boolean decode404() default false;
	
	/**
	 * 
	 * @return
	 */
	Class<? extends Options> options() default Request.Options.class;
}
